package com.jk.service;

import com.jk.dao.GzrzDao;
import com.jk.entity.GzrzEntity;
import com.jk.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public class GzrzService {
    @Autowired
    private GzrzDao gzrzDao;

    public void addGzrz(GzrzEntity gzrzEntity, HttpServletRequest request) {
        UserEntity user = (UserEntity) request.getSession().getAttribute("user");
        Integer id = user.getId();
        gzrzEntity.setUid(id);
        gzrzDao.addGzrz(gzrzEntity);
    }

    public List<GzrzEntity> getGzrz() {
        return gzrzDao.getGzrz();
    }
}
